<template>
  <div class="L-Flow-container">
    <van-overlay :show="overlayShow" :z-index="1000">
      <div style="display: flex;align-items: center;justify-content: center;height: 100%;">
        <van-loading type="spinner" color="#1989fa">请稍候...</van-loading>
      </div>
    </van-overlay>
    <div style="margin-bottom: 10vh;">
      <van-collapse v-model="activeNames">
        <van-collapse-item size="large" v-for="item in jsondata.head" :key="item.grouptitle" :name="item.grouptitle"
          :title="item.grouptitle">
          <van-cell-group style="border:0px;">
            <div style="border-bottom:1px solid #ebedf0" v-for="itemdata in item.groupvalue" :key="itemdata.ID">
              <idatetime ishead :itemdata="itemdata"
                v-if="itemdata.sUIType == 'datetime' || itemdata.sUIType == 'yearmonth'" />
              <icode @handleFiledLink="handleFiledLink" ishead :itemdata="itemdata"
                v-else-if="itemdata.sUIType == 'code'" />
              <ienum @handleFiledLink="handleFiledLink" ishead :itemdata="itemdata"
                v-else-if="itemdata.sUIType == 'enum'" :jsondata="jsondata" :idobject="idobject" />
              <iref @handleFiledLink="handleFiledLink" ishead :itemdata="itemdata" v-else-if="itemdata.sUIType == 'ref'"
                :clickmodel.sync="clickmodel" :clickfrom.sync="clickfrom" :clickindexName.sync="clickindexName"
                :clickindex.sync="clickindex" :jsondata="jsondata" :activeNames="activeNames" />
              <ibool @handleFiledLink="handleFiledLink" ishead :itemdata="itemdata"
                v-else-if="itemdata.sUIType == 'bool'" :jsondata="jsondata" :idobject="idobject" />
              <ifile ishead :itemdata="itemdata" v-else-if="itemdata.sUIType == 'file'" :jsondata="jsondata" />
              <ipicture ishead :itemdata="itemdata" v-else-if="itemdata.sUIType == 'picture'" :jsondata="jsondata" />
              <istring @handleFiledLink="handleFiledLink" ishead :itemdata="itemdata"
                v-else-if="itemdata.sUIType == 'string'" :jsondata="jsondata" :idobject="idobject" />
              <imap ishead :itemdata="itemdata" v-else-if="itemdata.sUIType == 'map'" :jsondata="jsondata"
                :item="item" />
              <istring @handleFiledLink="handleFiledLink" ishead :itemdata="itemdata" v-else :jsondata="jsondata"
                :idobject="idobject" />
            </div>
          </van-cell-group>
        </van-collapse-item>
      </van-collapse>
    
    </div>

   


  </div>
</template>

<script>
import Vue from 'vue'
import { Panel, Dialog, Search, List, Cell, PullRefresh, Toast, Tabbar, TabbarItem, Popup, DatetimePicker, ActionSheet, Tab, Tabs, Collapse, CollapseItem, Checkbox, CheckboxGroup, Uploader, Overlay, Loading, Rate, NumberKeyboard } from 'vant'
import qs from 'qs'
import useInput from '@/views/flow/useinput'
import * as dd from 'dingtalk-jsapi'
import { fieldLinkMixins } from '@/mixins/fieldLink.js'
import { fieldMapMixins } from '@/mixins/fieldmap.js'

Vue.use(Panel).use(Dialog).use(useInput).use(Search).use(List).use(Cell).use(PullRefresh).use(Toast).use(Tabbar).use(TabbarItem).use(Popup).use(DatetimePicker).use(ActionSheet).use(Tab).use(Tabs).use(Collapse).use(CollapseItem).use(Checkbox).use(CheckboxGroup).use(Uploader).use(Overlay).use(Loading).use(Rate).use(NumberKeyboard)
export default {
  name: 'FlowcardBodyForm',
  mixins: [fieldLinkMixins, fieldMapMixins],
  props: {
    idobject: {
      type: String,
      default: ""
    },
    itemid: {
      type: String,
      default: ""
    },
    jsondata: {
      type: Object,
      default: {}
    },
    activeNames: {
      type: String,
      default: ""
    },

    


  },
  data() {
    return {
      // idobject: this.$route.query.idobject,
      // jsondata: {},
      index: 0,
      active: 0,
      // activeNames: [''],
      activeBodyNams: [''],
      clickmodel: {},
      clickindexName: '',
      isLoad: false,
      clickfrom: '',
      clickindex: 0,
      isDisable: false,
      overlayShow: false
    }
  },

  mounted: function () {


  
  },
  methods: {
    detailTitle(indexName, item, index) {
      for (let i = 0; i < item.length; i++) {
        if (item[i].sField == this.jsondata.titleField) {
          return (index + 1) + '.' + (item[i].value.length > 0 ? item[i].value : '新' + indexName)
        }
      }
      return indexName + (index + 1)
    },
  }
    
}
</script>

<style scoped>
.fieldgroup_title {
  text-align: left;
  margin: 0px;
  padding: 25px 15px 15px;
  color: rgba(69, 90, 100, 0.6);
  font-weight: normal;
  font-size: 14px;
}

.L-Flow-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  position: relative;
}
.L-bottom-flow-body-save-row{
  position:fixed;
  width: 100%;
  bottom: 0;
  left: 0;
}
</style>
